// WorkDlg.cpp : implementation file
//

#include "stdafx.h"
#include "OCyEntropiaSSP.h"
#include "WorkDlg.h"
#include "Resource.h"

#define			N_MAX 30

// CWorkDlg dialog
CWorkDlg::CWorkDlg(const std::vector<long> &set, long n, CWnd* pParent /*=NULL*/)
	:	CDialog(CWorkDlg::IDD),
		m_set(set),
		m_N(n)
{
}

CWorkDlg::~CWorkDlg()
{
}

void CWorkDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_LST_SORTING_ANALISYS, m_lstSortingAnalisys);
}


BEGIN_MESSAGE_MAP(CWorkDlg, CDialog)
	ON_BN_CLICKED(IDC_BTN_ANILIZE_NOW, &CWorkDlg::OnBnClickedBtnAnilizeNow)
	ON_BN_CLICKED(IDC_BTN_DOWNSIZE_CANONIC_METHOD, &CWorkDlg::OnBnClickedBtnDownsizeCanonicMethod)
	ON_BN_CLICKED(IDC_BTN_DOWNSIZE_METHOD_1, &CWorkDlg::OnBnClickedBtnDownsizeMethod1)
END_MESSAGE_MAP()


// CWorkDlg message handlers

//--------------------------------------------------------------------------------------
// COCyEntropiaSSPDlg message handlers
BOOL CWorkDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
//	SetIcon(m_hIcon, FALSE);		// Set small icon

	m_spinValue.resize(N_MAX);
	m_edValue.resize(N_MAX);

	InitControls();
	for (int i=1 ; i<=m_N; ++i)
	{
		long val = m_set[i];
		m_spinValue[i]->SetRange(0,val);
		m_spinValue[i]->SetPos(val);
	/*
		m_spinValue[i].SetBuddy();
		m_spinValue[i].SetRange(,);
		m_spinValue[i].SetPos();

		m_lstSortingAnalisys.	SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_ONECLICKACTIVATE|LVS_EX_TWOCLICKACTIVATE);

		m_lstSortingAnalisys.	InsertColumn(i-1,TEXT("K"),		LVCFMT_LEFT, 30);
		m_lstSortingAnalisys.	InsertColumn(1,TEXT("Ordrd?"),	LVCFMT_LEFT, 60);
		m_lstSortingAnalisys.	InsertColumn(2,TEXT("#ok"),		LVCFMT_LEFT, 40);		
		int colMS = i+cFstColMS;
		int indMS = i;
		CString strPos;
		strPos.Format(L"Pos %d", indMS);
		m_lstSortingAnalisys.InsertColumn(colMS,strPos, LVCFMT_LEFT, 53);

		// Muestro en el combo los valores calculados para Gauss
		int posG = i-1;
		int indG = i;
		CString strG;
		strG.Format(L"%d", Gauss(indG));
		m_cboGauss.InsertString(posG,strG);
		m_cboGauss.SetCurSel(0);
	*/
	}

	/*
	for (int i=1 ; i<=15 ; ++i)	// <=cMaxN
	{
		ShowMultiset(m_lsKcci, cFstColK, nColumnCount, row, multiKccis);
	}
	*/
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CWorkDlg::InitControls()
{
	for (int i=1 ; i<=m_N; ++i)
	{
		const CRect cEdRect(CPoint(85*(i-1)+10,30),CSize(95,25));
		m_edValue[i] = new CEdit();
		m_edValue[i]->Create(  WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_CENTER | ES_NUMBER, 
								cEdRect, this ,IDC_ED_VALUE_BASE+i);

		const CRect cSpinRect(CPoint(90*(i-1)+55,30),CSize(15,25));
		m_spinValue[i] = new CSpinButtonCtrl();
		m_spinValue[i]->Create(   WS_CHILD | WS_VISIBLE | WS_TABSTOP | UDS_ALIGNRIGHT | UDS_ARROWKEYS 
								| UDS_AUTOBUDDY | UDS_SETBUDDYINT, 
								cSpinRect, this, IDC_SPN_VALUE_BASE+i);

		m_spinValue[i]->SetBuddy(m_edValue[i]);
	}
}
void CWorkDlg::OnBnClickedBtnAnilizeNow()
{
	// TODO: Add your control notification handler code here
}


void CWorkDlg::OnBnClickedBtnDownsizeCanonicMethod()
{
	// TODO: Add your control notification handler code here
}

void CWorkDlg::OnBnClickedBtnDownsizeMethod1()
{
	// TODO: Add your control notification handler code here
}
